import request from '@/util/request'

export function getRoleList() {
    return request({
        url: '/role/getRoleList',
        method: 'get'
    })
}

export function getPermissionList() {
    return request({
        url: '/role/getPermissionList',
        method: 'get'
    })
}

export function addRole(roleForm) {
    return request({
        url: '/role/addRole',
        method: 'post',
        data: roleForm
    })
}

export function delRole(role_id) {
    return request({
        url: '/role/delRole',
        method: 'post',
        data: {
            role_id: role_id
        }
    })
}

export function editRole(roleForm) {
    return request({
        url: '/role/editRole',
        method: 'post',
        data: roleForm
    })
}

export function getPermListById(role_id) {
    return request({
        url: '/role/getPermListById',
        method: 'get',
        params: { role_id: role_id }
    })
}

export function dispatchPerm(role_id, ps_ids) {
    return request({
        url: '/role/dispatchPerm',
        method: 'post',
        data: {
            role_id: role_id,
            ps_ids: ps_ids
        }
    })
}

export function getExpPermListById(ps_ids) {
    return request({
        url: '/role/getExpPermListById',
        method: 'get',
        params: {
            ps_ids: ps_ids
        }
    })
}

export function delPermById(role_id, ps_ids) {
    return request({
        url: '/role/delPermById',
        method: 'post',
        data: {
            role_id: role_id,
            ps_ids: ps_ids
        }
    })
} 